package main

import "fmt"

func modify(a *int) {
  *a = 100
}

func modify_arr(a *[3]int) {
  (*a)[0] = 100
}

func modify_slice(sls []int/*切片本身就是引用类型,无需在前面加* */) {
  sls[0]= 90
}

func testPoint(){
  var b int = 10
  p := &b
  modify(p)
  fmt.Printf("b:%d\n",b) //b:100
}

func testPoint2(){
  var b = [3]int{1, 2, 3}
  modify_arr(&b)
  fmt.Printf("b:%d\n",b) //b:[100 2 3]
}

func testPoint3(){
  a := [3]int{89,90,91}
  modify_slice(a[:])
  fmt.Println(a)
}

func main() {
  //testPoint()

  testPoint2()
}
